package com.lsh.payment.service;

import com.alibaba.dubbo.rpc.RpcContext;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;

import javax.servlet.http.HttpServletRequest;

/**
 * @author peter
 */
@Slf4j
public class BaseService {

    /**
     * 获取request数据
     *
     * @param
     * @return
     */
    public Long getVenderId() {

        String venderId = null;
        HttpServletRequest request = (HttpServletRequest) RpcContext.getContext().getRequest();
        if (request != null) {
            venderId = request.getHeader("venderId");
        }

        if (StringUtils.isBlank(venderId)) {
            return 0L;
        }


        return Long.parseLong(venderId);
    }


}
